/**
 * @Project : ProgrammingExercises
 * @Package : ACWing._2LanQiao._5BinaryIndexedTree_SegmentTree
 * @File : Q1264.java
 * @Author : WangRuoyu
 * @Date 2023/3/16 21:32
 */

package acwing._2LanQiao._5BinaryIndexedTree_SegmentTree;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 * @Project : ProgrammingExercises
 * @Package : ACWing._2LanQiao._5BinaryIndexedTree_SegmentTree
 * @File : Q1264_1.java
 * @Author : WangRuoyu
 * @Date 2023/3/16 21:32
 */

public class Q1264_1 {
    static int n;
    static int m;
    static int[] a;
    static int[] tree;

    static int lowbit(int x) {
        return x & -x;
    }

    static void add(int x, int c) {
        for (int i = x; i <= n; i += lowbit(i)) {
            tree[i] += c;
        }
    }

    static int sum(int x) {
        int ans = 0;
        for (int i = x; i > 0; i -= lowbit(i)) {
            ans += tree[i];
        }
        return ans;
    }

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] words = br.readLine().split(" ");

        n = Integer.parseInt(words[0]);
        m = Integer.parseInt(words[1]);

        a = new int[n + 1];
        tree = new int[n + 1];

        words = br.readLine().split(" ");
        for (int i = 1; i <= n; i++) {
            a[i] = Integer.parseInt(words[i - 1]);
            add(i, a[i]);
        }

        for (int i = 0; i < m; i++) {
            words = br.readLine().split(" ");
            int k = Integer.parseInt(words[0]);
            int x = Integer.parseInt(words[1]);
            int y = Integer.parseInt(words[2]);
            if (k == 0) {
                System.out.println(sum(y) - sum(x - 1));
            } else {
                add(x, y);
            }
        }
    }
}